package persistencia;

import java.sql.*;
import java.util.logging.Level;

public class IntermediarioPersistenciaRelacional extends IntermediarioPersistencia {
	
	public abstract String crearSQL(int nro);
    public abstract Object convertirRegAObject(ResultSet rs);
    @Override
    public Object materializar(int nro){
       ResultSet rs = null;
        try {
            String url = "jdbc:mysql://localhost:3306/pps";
            Class.forName("org.gjt.mm.mysql.Driver");
            Connection con = DriverManager.getConnection(url, "root", "root");
            Statement stm = con.createStatement();
            rs = stm.executeQuery(crearSQL(nro));
            
            }
        catch (SQLException ex) {
            Logger.getLogger(IPRelacionalEstudiante.class.getName()).log(Level.SEVERE, null, ex);
            }
        catch (ClassNotFoundException ex) {
            Logger.getLogger(IPRelacionalEstudiante.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return convertirRegAObject(rs);
        
    }

}
